<?php

$criteria = new CDbCriteria();
$criteria->compare('trangthai',2);
$orderthanhcong = Muadichvu::model()->findAll($criteria);



$tongorder = Muadichvu::model()->findAll();

$now = DateUtils::getDateNow();
$criteria = new CDbCriteria();
$criteria->addCondition('ngaymua > "'.$now.'" ');
$orderhomnay = Muadichvu::model()->findAll($criteria);



?>
	<div class='row'>Order today: <?php echo MyConstans::getFormatNumber(count($orderhomnay));?></div>	
	<div class='row'>Total Order: <?php echo MyConstans::getFormatNumber(count($tongorder));?></div>
		<div class='row'>Done: <?php echo MyConstans::getFormatNumber(count($orderthanhcong));?></div>
	
	<?php 
	if(UserUtils::isAdmin()){
		$criteria = new CDbCriteria();
		$criteria->compare('trangthai',1);
		$dangorder = Muadichvu::model()->findAll($criteria);
				
		$user = User::model()->findAll();
		$credits = Credit::model()->findAll();
		$tongcredit = 0;
		foreach($credits as $cre){
			$tongcredit += $cre->sodu;
		}
		?>
	<div class='row'>Pendding: <?php echo MyConstans::getFormatNumber(count($dangorder));?></div>
	<div class='row'>User: <?php echo MyConstans::getFormatNumber(count($user));?></div>
	<div class='row'>Tổng credit: <?php echo MyConstans::getFormatNumber($tongcredit);?></div>
	<?php 
	}
	?>
	
